package demo1;

import java.util.Timer;
import java.util.TimerTask;

public class test{
    public static void main(String[] args) {
        Timer timer=new Timer();
        timer.schedule(new TimerTask(){//Timertask继承runnable'
            @Override
            public void run() {
                System.out.println("2000");
            }
        },2000);
        timer.schedule(new TimerTask(){
            @Override
            public void run() {
                System.out.println("3000");
            }
        },3000);
        System.out.println("开始");
    }
}